/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2018 All Rights Reserved.
 */
package com.citytsm.gateway.sdk.response;

import com.citytsm.gateway.sdk.utils.ApiConstants;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * 调用ApiClient的execute方法后会直接返回该类。getResponse可以直接获取T的实例
 * @author jiangbingkun
 * @version $Id: BaseResponse.java, v 0.1 2018年01月06日 下午4:08 jiangbingkun Exp $
 */
public class BaseResponse implements Serializable {

    private static final long serialVersionUID = 818921014094651340L;

    private String code;

    private String msg;

    @JsonProperty(ApiConstants.RESPONSE_SUBCODE)
    private String subCode;

    @JsonProperty(ApiConstants.RESPONSE_SUBMESSAGE)
    private String subMsg;

    private Object data;

    private String method;

    private String sign;

    public boolean isSuccess(){
        return (StringUtils.isNotBlank(this.code) && "10000".equals(this.code));
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getSubCode() {
        return subCode;
    }

    public void setSubCode(String subCode) {
        this.subCode = subCode;
    }

    public String getSubMsg() {
        return subMsg;
    }

    public void setSubMsg(String subMsg) {
        this.subMsg = subMsg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }
}